<template>
  <div>
    <van-nav-bar title="评论列表" left-arrow @click-left="onClickLeft"></van-nav-bar>
    <div v-for="(item, index) in datalist" :key="index">
      <div style="display: flex;width: 100vw;height: 80px;border: 1px solid #eee;justify-content: space-between;">
        <div>
          <img :src="item.headPic" alt="" style="width: 50px; height: 50px" />
          <div>昵称：{{ item.nickName }}</div>
        </div>
        <div style="display: flex;align-items: center;">
            <div>
                 评论内容：{{ item.content }}
            </div>
            <button style="margin-left: 20vw" @click="caina(item.commentId)">采纳</button>
        </div>
      </div>
    </div>
  </div>
</template>
<script setup lang="ts">
import { adoptionProposal, findMySickCircleCommentList } from '@/api/search'
import { ref } from 'vue'
const datalist:any = ref({})
const userId = ref(parseInt(localStorage.getItem('userId') as string))
const sessionId = ref(JSON.parse(localStorage.getItem('sessionId') as string))
const sickCircleId = ref(parseInt(localStorage.getItem('sickCircleId') as string))
const onClickLeft = () => {
  history.back()
}
const findMySickCircleCommentList1 = async () => {
  const res = await findMySickCircleCommentList(userId.value, sessionId.value, {
    sickCircleId: sickCircleId.value,
    page: 1,
    count: 5
  })
  console.log('查询评论列表', res.data.result.otherSickCircleCommentList)
  datalist.value = res.data.result.otherSickCircleCommentList
}
findMySickCircleCommentList1()
const caina=async(commentId:number)=>{
    const res=await adoptionProposal(userId.value,sessionId.value,{
        commentId:commentId,
        sickCircleId:sickCircleId.value,
    })
    console.log("采纳评论",res);
}
</script>
<style>
</style>